#' ---
#' title: "Greenwashing the Future? Computational Text Analysis of Environmental Reporting from the Fossil Fuel Industry"
#' subtitle: "00_reproduce_analysis.R"
#' author: "Robin Rauner"
#' ---

#+ setup, message=FALSE, warning=FALSE
# Required packages and version used
library(mltest)             # CRAN v1.0.1
library(tidycomm)           # CRAN v0.4.1
library(tidyverse)          # CRAN v2.0.0
library(rio)                # CRAN v1.2.2
library(ggthemes)           # CRAN v5.1.0
library(gridExtra)          # CRAN v2.3
library(quanteda)           # CRAN v4.1.0
library(quanteda.textstats) # CRAN v0.97.2
library(quanteda.textplots) # CRAN v0.95
library(texreg)             # CRAN v1.39.4
library(ggrepel)            # CRAN v0.9.6
library(xtable)             # CRAN v1.8.4

#+ run-dict-analysis
# Run R script
source("01_dictionary_analysis.R")

#+ render-dict-analysis
# Render script as HTML
rmarkdown::render(
    "01_dictionary_analysis.R",
    output_format = "html_document"
)

#+ run-performance-metrics
# Run R script
source("02_performance_metrics.R")

#+ render-performance-metrics
# Render script as HTML
rmarkdown::render(
    "02_performance_metrics.R",
    output_format = "html_document"
)

#+ run-fls-score
# Run R script
source("03_calculate_FLS_score.R")

#+ render-fls-score
# Render script as HTML
rmarkdown::render(
    "03_calculate_FLS_score.R",
    output_format = "html_document"
)

#+ run-analysis
# Run R script
source("04_analysis.R")

#+ render-analysis
# Render script as HTML
rmarkdown::render(
    "04_analysis.R",
    output_format = "html_document"
)